<?php
namespace app\api\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Room extends Validate
{
    //定义验证规则
    protected $rule = [
        'name|房间名称' =>'require',
        //'desc|房间描述' =>'require',
        'bed_num|床位' =>'require',
        'type_id|房间类型' =>'require',
        'toilet|卫生间' =>'require',
        'clean_price|净房提成' =>'require',
        'clean_rule|净房规则' =>'require',
        'book_price|订房提成' =>'require',
        'book_room|订房规则' =>'require',
        'interval_time|间隔时间' =>'require',
    ];
    //定义验证提示
    protected $message = [
        'name.require' => '请填写房间名称',
        //'desc.require' => '请填写描述',
        'type_id.require' => '请填写房间类型',
        'bed_num.require' => '请填写床位',
        'toilet.require' => '请填写卫生间',
        'clean_rule.require' => '请填写净房规则',
        'clean_price.require' => '请填写净房提成',
        'book_room.require' => '请填写订房规则',
        'book_price.require' => '请填写订房提成',
        'interval_time.require' => '请填写间隔时间',
    ];
    //定义验证场景
    protected $scene = [
        'add_room'   =>  ['name','type_id','bed_num','toilet','clean_rule','clean_price','book_room','interval_time'],
        'edit_room'   =>  ['name','type_id','bed_num','toilet','clean_rule','clean_price','book_room','interval_time'],
    ];
}
